package sword;

/**
 * @Author: 海琳琦
 * @Date: 2022/5/26 20:42
 * https://leetcode.cn/problems/fan-zhuan-lian-biao-lcof/
 */
public class Title24 {

    class ListNode{
        int val;

        ListNode next;

        public ListNode(int val) {
            this.val = val;
        }

    }

    public ListNode reverseList(ListNode head) {
        ListNode cur = head;
        ListNode pre = null;
        while (cur != null) {
            ListNode temp = cur.next;
            cur.next = pre;
            pre = cur;
            cur = temp;
        }
        return pre;
    }

    public static void main(String[] args) {

    }
}
